home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 August: Tool Chest / Dev.CD Aug 99 TC.toast / What's New? / Development Kits / Hardware / Mac OS USB DDK v1.3a1 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-16  |  2.6 KB  |  100 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #define kMouseModuleName    "\pUSBHIDMouseModule"
  22.  
  23. Boolean    immediateError(OSStatus err);
  24. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  25. void     MouseInitiateTransaction(USBPB *pb);
  26. void     MouseCompletionProc(USBPB *pb);
  27. void     WatchDogCompletionProc(USBPB *pb);
  28. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  29.  
  30. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  31. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  32. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  33.  
  34. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  35. void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
  36.  
  37. void     USBMouseIn(UInt32 refcon, void * theData);
  38.  
  39. #define kMouseRetryCount    3
  40.  
  41. enum driverstages
  42. {  
  43.     kUndefined = 0,
  44.     kSetProtocol,
  45.     kSetIdleRequest,
  46.     kConfigureInterface,
  47.     kFindPipe,
  48.     kReadInterruptPipe,
  49.     kReturnFromDriver =     0x1000,
  50.     kRetryTransaction =     0x2000,
  51.     kCompletionInProgess =     0x4000,
  52.     kCompletionPending =     0x8000,
  53.     kStageMask =             0x00ff
  54. };
  55.  
  56. enum watchdogstates
  57. {
  58.     kDelay10Seconds = 1,
  59.     kCheckForAbort
  60. };
  61.  
  62. typedef struct
  63. {
  64.     USBPB                             pb;
  65.     void (*handler)(USBPB             *pb);
  66.     
  67.     Boolean                            intPipeAborted;
  68.     Boolean                            driverRemovalPending;
  69.     
  70.     Boolean                            watchDogActivityFlag;
  71.     Boolean                            watchDogAbortFlag;
  72.     UInt32                            watchDogState;
  73.  
  74.     USBReference                    interfaceRef;
  75.     USBPipeRef                        pipeRef;
  76.     
  77.     USBDeviceDescriptor             deviceDescriptor;
  78.     USBInterfaceDescriptor            interfaceDescriptor;
  79.  
  80.     UInt32                            hidDeviceType;
  81.     UInt8                            hidReport[64];
  82.     UInt32                            maxPacketSize;
  83.     
  84.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  85.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  86.     
  87.     UInt32                            interruptRefcon;
  88.     
  89.     HIDNotificationProcPtr             pNotificationRoutine;
  90.     UInt32                            notificationRefcon;
  91.     
  92.     SInt32                             retryCount;
  93.     SInt32                            transDepth;
  94.     
  95.     CursorDevicePtr                    pCursorDeviceInfo;
  96.     CursorDevice                    cursorDeviceInfo;
  97.     Fixed                            unitsPerInch;
  98. } usbMousePBStruct;
  99.  
  100. #endif //__MouseModuleH__